window.onload = function(e) {
   if (document.getElementById && document.getElementById("CurrentSize") != null) {
	if(document.getElementById("CurrentSize").value == "")
		resetCurrentsize();
	else
		setCurrentsize(document.getElementById("CurrentSize").value);
 
    document.getElementById("textSizer").style.cssText = "display: block; float: right;";
  }
}
	
function getCurrentsize() {
  return currentSize;
}

function setCurrentsize(newsize) {
  currentSize = newsize;
  if (document.getElementById) {
  	document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  	document.getElementById("textSizer").style.cssText = "display: block;";
  }  
}

function resetCurrentsize() {
  currentSize = 13;
  document.getElementById("CurrentSize").value = currentSize;
  if (document.getElementById) {
  	document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";  	
  }
}

function sizeUp() {
  if (document.getElementById) {
    currentSize++;
    document.getElementById("CurrentSize").value = currentSize;
    document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  }
}

function ArticlePagingView(urlPath, view, ric, storyId, pageNumber, WTModLoc) {  
	if (document.getElementById) 
	{
		var tempSize = document.getElementById("CurrentSize").value;
		document.getElementById("resizeableText").style.cssText = "font-size:"+tempSize+"px";
		var qsWT = '';
		if (WTModLoc != null && WTModLoc != '')
			qsWT = '&WTModLoc=' + WTModLoc;
		window.location.href = urlPath + "?view=" + view + "&symbol=" + ric + "&storyID=" + storyId + "&pageNumber=" + pageNumber + qsWT + "&sz=" + tempSize;
		
	}
}

function ArticlePaging(urlPath, categoryType, storyId, pageNumber, imageId, caption, WTModLoc) {  
	if (document.getElementById) 
	{
		if(document.getElementById("CurrentSize") != null)
			var tempSize = document.getElementById("CurrentSize").value;
		if(document.getElementById("resizeableText") != null)
			document.getElementById("resizeableText").style.cssText = "font-size:"+tempSize+"px";
		var qsWT = '';
		if (WTModLoc != null && WTModLoc != '')
			qsWT = '&WTModLoc=' + WTModLoc;
		window.location.href = urlPath + "?type=" + categoryType + "&storyID=" + storyId + "&pageNumber=" + pageNumber + "&imageid=" + imageId + "&cap=" + caption + "&sz=" + tempSize + qsWT;
	}
}

function sizeDown() {
  if (document.getElementById) {
    currentSize--;
    document.getElementById("CurrentSize").value = currentSize;
    document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  }
}

var previousDiv = null;
var previousClasses = null;

function callItOut(divName) {
  if (document.getElementById) {
    currentClasses = document.getElementById(divName).className;
    document.getElementById(divName).className += " articleHighlight";
    if (previousDiv != null) {
      document.getElementById(previousDiv).className = previousClasses;
    }
    previousDiv = divName;
    previousClasses = currentClasses;
  }
}

function unCallIt(divName) {
  if (document.getElementById) {
    document.getElementById(divName).className = previousClasses;
    previousDiv = null;
    previousClasses = null;
  }
}

function selectChart(chartname) {
  if (document.getElementById) {
    clearAll();
    document.getElementById(chartname).className = "selected";
    document.getElementById(chartname+"chart").className = "";
  }
}

function clearAll() {
    document.getElementById("r1").className = "";
    document.getElementById("r2").className = "";
    document.getElementById("r3").className = "";
    document.getElementById("r1chart").className = "hidden";
    document.getElementById("r2chart").className = "hidden";
    document.getElementById("r3chart").className = "hidden";
}